#include <iostream>
using namespace std;

class Car;

class Boat{
    private:
        int weight;
        int person;
    public:
        Boat(){}
        Boat(int w, int p):weight(w), person(p){}
        ~Boat(){}
        // 声明友元
        friend void total(Boat &x, Car &y);
};

class Car{
    private:
        int weight;
        int person;
    public:
        Car(){}
        Car(int w, int p):weight(w), person(p){}
        ~Car(){}
        // 声明友元
        friend void total(Boat &x, Car &y);
};

void total(Boat &x, Car &y){
    cout << x.weight + y.weight << endl;
    cout << x.person + y.person << endl;
}

int main(int argc, const char *argv[]){
    Boat b1(2000, 100);
    Car c1(500, 20);
    total(b1, c1);
    return 0;
}